# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=cluster-glue
pkgver=1.0.12
pkgrel=2
pkgdesc="Reusable cluster components"
url="https://clusterlabs.org"
arch="all"
license="GPL-2.0-only AND LGPL-2.1-or-later"
depends=""
depends_dev="net-snmp-dev libxml2-dev glib-dev bzip2-dev curl-dev
	e2fsprogs-dev libaio-dev"
makedepends="$depends_dev asciidoc autoconf automake libtool"
install=""
pkggroups="haclient"
pkgusers="hacluster"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="https://github.com/ClusterLabs/cluster-glue/archive/glue-$pkgver.tar.gz
	$pkgname.post-install
	$pkgname.pre-install"

builddir="$srcdir"/$pkgname-glue-$pkgver

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--enable-fatal-warnings=no \
		--with-daemon-group="$pkggroups" \
		--with-daemon-user="$pkgusers"
	make
}

package() {
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/etc/init.d
	# initd file needs fixing
	#install -m755 -D "$srcdir"/ha_logd.initd \
	#	"$pkgdir"/etc/init.d/ha_logd || return 1
}

libs() {
	pkgdesc="Reusable cluster components (libraries)"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so.* \
		"$subpkgdir"/usr/lib/
}

sha512sums="e0da2b17499fb4ba83bb3414123fd00b44f24b3ef817a4802f628467e2876bb8a453b99e4443439edb31de315e8d76292694584e27dbf4310efdc8d438a25272  glue-1.0.12.tar.gz
9d75933e002f938b5ac76170db5f1fd80e89172482186a44fe905d1e27c313d79bcff18e3564023ba94f2eeff3cc25811ea30b3ad06fa345a854b4e4da492bee  cluster-glue.post-install
819641edd4aac839cc26c4398f664dc96ccad23bc2c9e813536166852fc01cadfee71294222a40466113bf0ceafb15a55482307a893785b436b3d9e98b58ea0c  cluster-glue.pre-install"
